package com.doctcloud.hisinfo.histable.domain.comm;

import com.doctcloud.common.core.annotation.TableDesc;
import lombok.*;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

import static com.doctcloud.common.core.utils.StringUtils.trim;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode(of = {"accountName"})
@TableDesc("药品科目字典")
public class DrugAccountDictDo implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 序号 */
    private Integer serialNo;
    /** 药品科目代码 */
    @NotBlank(message = "药品科目代码不得为空")
    private String accountCode;
    /** 药品科目名称 */
    @NotBlank(message = "药品科目名称不得为空")
    private String accountName;
    @Data
    public static class primaryKey {
        private final String accountName;
        public primaryKey(String accountName) {
            this.accountName = accountName;
        }
    }

    public void setAccountName(String accountName) {
        this.accountName = trim(accountName);
    }
}
